The present invention relates to a control method of cache storage in a computer system with main storage and secondary storage that is provided to minimize a difference in access speed between a main storage and a secondary storage, and more particularly to a cache control method, for use in a computer system with multiple hierarchical levels of cache storage, to increase the utilization of cache included in the entire system.
In general, a computer system has two types of storage: one is a primary storage, such as main storage (MS), accessible directly by an instruction processor (IP) and the other is a secondary storage, such as a magnetic disk, not accessible directly by an IP. As compared with main storage, secondary storage has limitations on access methods and access speeds. For example, the access speed of a magnetic disk is much slower than that of MS.
Cache storage, or simply called a cache, is a storage provided between main storage and secondary storage to minimize a difference in access speed between main storage and secondary storage. In general, cache storage has a speed higher than that of secondary storage, and a capacity smaller than that of secondary storage. For example, the operating system of a computer system sometimes has an input/output buffer in MS. This buffer is an example of software-implemented cache storage. Also, secondary storage sometimes contains its own cache storage. For example, a disk unit contains cache storage of semiconductor memory in many cases to increase its access performance.
When a data is read from a disk unit that contains cache storage and that is connected to a computer where an operating system with an input/output buffer is running, data is first transferred from a magnetic disk of the disk unit to the cache storage of the disk unit and then from the cache storage of the disk unit to the input/output buffer in MS. After that, data is passed from the input/output buffer to a data-requesting program. In this way, multiple levels of cache storage may be provided in one computer system.
Storing data in cache storage is referred to as staging, while erasing data from cache storage as destaging. In a computer system where multiple caches are provided, the caches are called the primary cache, secondary cache, and so on, beginning with the cache closest to the IP (in other words, beginning with the cache requiring the IP to execute the smallest number of steps to access data). For example, in the above example, the input/output buffer in MS is the primary cache and cache storage in the disk unit is the secondary cache. Using those terms, the above example is described as “data is first staged from a magnetic disk of the disk unit to the secondary cache and then staged from the secondary cache to the primary cache.”
In addition, from the point of view of some cache storage, cache storage with a smaller level number is called a high-level hierarchy cache, or simply called high-level cache, and cache storage with a larger level number is called a low-level hierarchy cache, or simply called a low-level cache. Using those terms, the above example is described as “data is first staged from a magnetic disk of the disk unit to a low-level (hierarchy) cache and then staged from the low-level (hierarchy) cache to the high-level (hierarchy) cache.”
Although smaller than secondary storage in size, cache storage has better access performance. This is because data accessed by a usual program has locality and, therefore, retaining frequently referenced data in cache storage allows many data access requests to be satisfied by accessing cache storage. Therefore, to increase access performance with the use of cache storage, it is necessary to take full advantage of cache storage to allow more frequently used data to be staged into cache storage as frequently as possible.
If, in a computer system where multiple levels of cache storage are provided, cache storage in each hierarchy controls the staging and destaging of data independently, the same data is sometimes staged across multiple hierarchies. In this case, out of the data staged in multiple levels of cache storage, only the data in one level of cache storage, usually the data in the cache in the highest hierarchy, is actually accessed. The data in other levels of cache storage is not accessed until the data in the highest hierarchy cache is destaged. From the viewpoints of the entire computer system, this configuration results in a waste of cache storage areas and decreases the cache storage utilization. In a computer system where multiple levels of cache storage are provided, this condition should be avoided if possible.
For example, in JP-A-2001-117817, there is disclosed a cache storage control method for increasing cache storage utilization. In this control method, data to be staged into cache storage is decided according to a method (called “swap mode” in the above-mentioned JP-A-2001-117817) that is different between high-level cache storage and low-level cache storage to minimize the duplication of data staged in multiple levels of cache storage and to increase the utilization of cache storage.
It is possible to increase the utilization of cache storage of the entire system with the prior-art cache storage control method that minimizes the chance that the same data is staged across multiple levels of cache storage in a computer system with multiple levels of cache storage. However, this method has the problems described below.
One of the problems is that, if the number of hierarchical levels of cache storage in a system increases, it is difficult to select different swap modes for all hierarchies, one for each. Although several cache-storage swap modes such as LRU (Least Recently Used) and FIFO (First In First Out) are known and used, there are not so many methods that actually function efficiently and that may be implemented at a practical cost. Therefore, as the number of cache hierarchical levels included in the system increases, it becomes more difficult to select a unique swap mode for each cache storage level.
Another problem is that limiting the cache-storage swap mode as described above sometimes reduces the utilization of cache storage. As described above, an improvement in access performance with the use of cache storage requires frequently accessed data to be staged in cache storage as much as possible and, therefore, it is desirable in the swap mode that a method be employed for selecting as much frequently accessed data as possible. This is true of cache storage in every hierarchy. However, the prior-art method described above limits the selection of swap mode and prevents cache storage in each hierarchy from employing a swap mode that successfully selects frequently accessed data. This may lead to a reduction in cache storage utilization.
In addition, even if each hierarchy selects its own swap mode, data duplication cannot always be avoided.